package com.lingx.model.impl.validator;

import java.util.Map;

import org.springframework.stereotype.Component;

import com.lingx.model.IContext;
import com.lingx.model.IPerformer;
import com.lingx.model.IValidator;
import com.lingx.model.annotation.FieldModelConfig;
import com.lingx.model.impl.AbstractModel;
import com.lingx.model.impl.AbstractValidator;
import com.lingx.model.impl.DefaultField;
@Component
public class EmailValidator extends AbstractValidator{

	private static final long serialVersionUID = -2073570933286592705L;
	
	public EmailValidator() {
		super("EmailValidator", "邮箱验证");
		this.setComment("不需要额外参数");
		this.setMessage(DEFAULT_MESSAGE+"，必须为电子邮箱格式");
	}

	@Override
	public boolean valid(Object value,String param,Map<String,Object> params,DefaultField code,IContext context)throws Exception {
		if(value==null)return false;
		String str=value.toString();
		return str.indexOf("@")>0;
	}

}
